//
//  TTViewController.m
//  123
//
//  Created by Wang on 14/11/19.
//  Copyright (c) 2014年 Wang. All rights reserved.
//

#import "TTViewController.h"
#import "TTModel.h"
#import "TTCell.h"
@interface TTViewController ()<UITableViewDelegate, UITableViewDataSource>

@end

@implementation TTViewController

- (void)dealloc
{
    [_array release];
    [super dealloc];
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.array = [NSMutableArray array];
    }
    return self;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view setBackgroundColor:[UIColor whiteColor]];
    [self.navigationItem setTitle:@"T台"];
    [self.navigationController.navigationBar setTranslucent:NO];
    [self creatTableView];
}

#pragma mark - 创建tabView 注册cell
- (void)creatTableView
{
    UITableView *tab = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 49) style:UITableViewStyleGrouped];
    tab.delegate = self;
    tab.dataSource = self;
    [tab registerClass:[TTCell class] forCellReuseIdentifier:@"cellPool"];
    [self.view addSubview:tab];
    [tab release];
}

#pragma mark - tableView有多少个section
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}

#pragma mark - 每个section 有多少行row
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 0) {
        return 1;
    }
//    return [_array count];
    return 10;
    
}

#pragma mark - row的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 200;
}


#pragma mark - tableView协议实现
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    TTCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellPool"];
    
    
    return cell;
}



#pragma mark - cell 点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
}














@end
